import {createWebHistory, createRouter} from "vue-router";
import Home from "@/views/Home";
import ArticleDetail from "@/views/ArticleDetail.vue";
import Login from "@/views/Login";
import UserCenter from "@/views/UserCenter";
import ArticleCreate from "@/views/ArticleCreate";
import ArticleEdit from "@/views/ArticleEdit";
import Register from "@/views/Register";


const router = createRouter({
    history: createWebHistory(),
    routes: [
        {
            path: "/",
            name: "Home",
            component: Home,
        },
        {
            path: "/articles/:id",
            name: "ArticleDetail",
            component: ArticleDetail
        },
        {
            path: "/login",
            name: "Login",
            component: Login
        },
        {
            path: "/register",
            name: "Register",
            component: Register
        },
        {
            path: "/users/:username",
            name: "UserCenter",
            component: UserCenter
        },
        {
            path: "/articles/create",
            name: "ArticleCreate",
            component: ArticleCreate
        },
        {
            path: "/articles/edit/:id",
            name: "ArticleEdit",
            component: ArticleEdit
        },
    ]
});

export default router;
